import { createRouter, createWebHistory } from "vue-router";
import routes from "./static.js";

const router = createRouter({
  history: createWebHistory(),
  routes,
});

router.beforeEach((to, from, next) => {
  const fileId = localStorage.getItem("fileId");
  if (to.name === "fileStart" && fileId) {
    next(`fileEnd?fileId=${fileId}`);
  } else {
    next();
  }
});
router.afterEach(() => {});

export default router;
